import * as clipboard from 'clipboard-polyfill/text'
import { ElMessage } from 'element-plus'
// ? 实现复制文本功能的方法
export const getCopyValue = (copyValue: string) => {
  clipboard.writeText(copyValue).then(
    function () {
      ElMessage({
        message: '复制成功',
        type: 'success',
      })
    },
    function () {
      ElMessage({
        message: '复制失败',
        type: 'error',
      })
    }
  )
}
export function guid() {
  return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
    var r = (Math.random() * 16) | 0,
      v = c == 'x' ? r : (r & 0x3) | 0x8
    return v.toString(16)
  })
}
